﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using FrienDev.BusinessRules;
using FrienDev.Data;
using System.Collections.Generic;

public partial class Controls_Users_RecentVisitorDetailList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ApiHelper.Instance.IsFriendsPage())
        {
            IEnumerable<User> visitors = VisitorRules.Instance.GetRecentVisitorListByUserId(ApiHelper.Instance.GetRequestUserId(), -1);
            visitorsList.DataSource = visitors;
            visitorsList.DataBind();
        }
        else
        {
            IEnumerable<User> visitors = VisitorRules.Instance.GetRecentVisitorListByUserId(UserRules.Instance.GetCurrentUserId(), -1);
            visitorsList.DataSource = visitors;
            visitorsList.DataBind();
        }
    }

    protected void HY_DataBinding(object sender, EventArgs e)
    {
        HyperLink hy = sender as HyperLink;
        hy.NavigateUrl = ApiHelper.Instance.GetUserHomepageLink(hy.NavigateUrl);
    }

    protected void Img_DataBinding(object seder, EventArgs e)
    {
        Image img = seder as Image;
        img.ImageUrl = ApiHelper.Instance.GetUserLogoUrl(img.ImageUrl);
    }
}
